feature check menu items in the compatibility code (this required me to
authorTim Janik <timj@gtk.org>
Sun, 7 Jun 1998 13:44:34 +0000 (13:44 +0000)
committerTim Janik <timj@src.gnome.org>
Sun, 7 Jun 1998 13:44:34 +0000 (13:44 +0000)
Sun Jun  7 14:34:31 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
        check menu items in the compatibility code (this required me to remove
        the "<check>" part from the menu item name, grrr).

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/glib.h
gtk/gtkitemfactory.c
gtk/gtkitemfactory.h

index 7698fffd0e7a408282f73cc3a38434f206251006..b090455242d9cd63d84beaa5b86dea102fbcea1f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sun Jun  7 14:34:31 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
+       check menu items in the compatibility code (this required me to remove
+       the "<check>" part from the menu item name, grrr).
+
 1998-06-07  Marius Vollmer  <mvo@zagadka.ping.de>
 
        * gdk/gdk.h (gdk_color_copy, gdk_color_free): New prototypes.
index 7698fffd0e7a408282f73cc3a38434f206251006..b090455242d9cd63d84beaa5b86dea102fbcea1f 100644 (file)
@@ -1,3 +1,9 @@
+Sun Jun  7 14:34:31 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
+       check menu items in the compatibility code (this required me to remove
+       the "<check>" part from the menu item name, grrr).
+
 1998-06-07  Marius Vollmer  <mvo@zagadka.ping.de>
 
        * gdk/gdk.h (gdk_color_copy, gdk_color_free): New prototypes.
index 7698fffd0e7a408282f73cc3a38434f206251006..b090455242d9cd63d84beaa5b86dea102fbcea1f 100644 (file)
@@ -1,3 +1,9 @@
+Sun Jun  7 14:34:31 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
+       check menu items in the compatibility code (this required me to remove
+       the "<check>" part from the menu item name, grrr).
+
 1998-06-07  Marius Vollmer  <mvo@zagadka.ping.de>
 
        * gdk/gdk.h (gdk_color_copy, gdk_color_free): New prototypes.
index 7698fffd0e7a408282f73cc3a38434f206251006..b090455242d9cd63d84beaa5b86dea102fbcea1f 100644 (file)
@@ -1,3 +1,9 @@
+Sun Jun  7 14:34:31 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
+       check menu items in the compatibility code (this required me to remove
+       the "<check>" part from the menu item name, grrr).
+
 1998-06-07  Marius Vollmer  <mvo@zagadka.ping.de>
 
        * gdk/gdk.h (gdk_color_copy, gdk_color_free): New prototypes.
index 7698fffd0e7a408282f73cc3a38434f206251006..b090455242d9cd63d84beaa5b86dea102fbcea1f 100644 (file)
@@ -1,3 +1,9 @@
+Sun Jun  7 14:34:31 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
+       check menu items in the compatibility code (this required me to remove
+       the "<check>" part from the menu item name, grrr).
+
 1998-06-07  Marius Vollmer  <mvo@zagadka.ping.de>
 
        * gdk/gdk.h (gdk_color_copy, gdk_color_free): New prototypes.
index 7698fffd0e7a408282f73cc3a38434f206251006..b090455242d9cd63d84beaa5b86dea102fbcea1f 100644 (file)
@@ -1,3 +1,9 @@
+Sun Jun  7 14:34:31 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
+       check menu items in the compatibility code (this required me to remove
+       the "<check>" part from the menu item name, grrr).
+
 1998-06-07  Marius Vollmer  <mvo@zagadka.ping.de>
 
        * gdk/gdk.h (gdk_color_copy, gdk_color_free): New prototypes.
index 7698fffd0e7a408282f73cc3a38434f206251006..b090455242d9cd63d84beaa5b86dea102fbcea1f 100644 (file)
@@ -1,3 +1,9 @@
+Sun Jun  7 14:34:31 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
+       check menu items in the compatibility code (this required me to remove
+       the "<check>" part from the menu item name, grrr).
+
 1998-06-07  Marius Vollmer  <mvo@zagadka.ping.de>
 
        * gdk/gdk.h (gdk_color_copy, gdk_color_free): New prototypes.
index c57aece366a7d3caf5908218af1c1a60a96a25bb..6dada468524fe127d0a198c21abf1629f2be1fb2 100644 (file)
 #define G_GNUC_CONST
 #endif  /* !__GNUC__ */
 
+/* Hacker macro to place breakpoints for x86 machines.
+ * Actuall use is strongly deprecated of course ;)
+ */
+#if    defined (__i386__)
+#define        G_BREAKPOINT()          G_STMT_START{ __asm__ ("int $03"); }G_STMT_END
+#else  /* !__i386__ */
+#define        G_BREAKPOINT()
+#endif /* __i386__ */
+
 /* Wrap the __PRETTY_FUNCTION__ and __FUNCTION__ variables with macros,
  * so we can refer to them as strings unconditionally.
  */
index 9ea6314e3e7a63a19ac36cb71a39faa8887efa27..7b71e8ed67406ad99e992475d00b5d80cdd14001 100644 (file)
@@ -1028,21 +1028,26 @@ void
 gtk_item_factory_create_menu_entries (guint              n_entries,
                                      GtkMenuEntry      *entries)
 {
-  static GtkPatternSpec pspec = { 42, 0 };
+  static GtkPatternSpec pspec_separator = { 42, 0 };
+  static GtkPatternSpec pspec_check = { 42, 0 };
   guint i;
 
   if (!n_entries)
     return;
   g_return_if_fail (entries != NULL);
 
-  if (pspec.pattern_length == 0)
-    gtk_pattern_spec_init (&pspec, "*<separator>*");
+  if (pspec_separator.pattern_length == 0)
+    {
+      gtk_pattern_spec_init (&pspec_separator, "*<separator>*");
+      gtk_pattern_spec_init (&pspec_check, "*<check>*");
+    }
 
   for (i = 0; i < n_entries; i++)
     {
       GtkItemFactory *ifactory;
       GtkItemFactoryEntry entry;
       gchar *path;
+      gchar *cpath;
 
       path = entries[i].path;
       ifactory = gtk_item_factory_from_path (path);
@@ -1057,17 +1062,41 @@ gtk_item_factory_create_menu_entries (guint              n_entries,
       while (*path != '>')
        path++;
       path++;
+      cpath = NULL;
 
       entry.path = path;
       entry.accelerator = entries[i].accelerator;
       entry.callback = entries[i].callback;
       entry.callback_action = 0;
-      entry.item_type = (gtk_pattern_match_string (&pspec, path) ?
-                        (gpointer) key_type_separator_item :
-                        NULL);
-
+      if (gtk_pattern_match_string (&pspec_separator, path))
+       entry.item_type = (gpointer) key_type_separator_item;
+      else if (!gtk_pattern_match_string (&pspec_check, path))
+       entry.item_type = NULL;
+      else
+       {
+         gboolean in_brace = FALSE;
+         gchar *c;
+         
+         cpath = g_new (gchar, strlen (path));
+         c = cpath;
+         while (*path != 0)
+           {
+             if (*path == '<')
+               in_brace = TRUE;
+             else if (*path == '>')
+               in_brace = FALSE;
+             else if (!in_brace)
+               *(c++) = *path;
+             path++;
+           }
+         *c = 0;
+         entry.item_type = (gpointer) key_type_toggle_item;
+         entry.path = cpath;
+       }
+      
       gtk_item_factory_create_item (ifactory, &entry, entries[i].callback_data, 2);
       entries[i].widget = gtk_item_factory_get_widget (ifactory, entries[i].path);
+      g_free (cpath);
     }
 }
 
index aad4ee635517060563d5d2cccdc63183921685c8..45dc181518e9d93984a878fb2796fd43a0ca3af3 100644 (file)
@@ -187,7 +187,7 @@ void        gtk_item_factory_popup_with_data(GtkItemFactory         *ifactory,
 gpointer gtk_item_factory_popup_data   (GtkItemFactory         *ifactory);
 gpointer gtk_item_factory_popup_data_from_widget (GtkWidget    *widget);
 
-/* Compatibility functions for ol GtkMenuFactory code
+/* Compatibility functions for deprecated GtkMenuFactory code
  */
 GtkItemFactory*        gtk_item_factory_from_path   (const gchar       *path);
 void   gtk_item_factory_create_menu_entries (guint              n_entries,